package cadtoolbox.graphical;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowEvent;

import javax.swing.JOptionPane;

public class AnimationOptions extends javax.swing.JFrame {

    /**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	/**
     * Creates new form RangeFrame
     */
    public AnimationOptions() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    
    private void initComponents() {

        jComboBox1 = new javax.swing.JComboBox();
        ScaleLabel = new javax.swing.JLabel();
        SizeLabel = new javax.swing.JLabel();
        jTextField1 = new javax.swing.JTextField();
        jCheckBox1 = new javax.swing.JCheckBox();
        jCheckBox2 = new javax.swing.JCheckBox();
        jCheckBox3 = new javax.swing.JCheckBox();

        //setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        this.addWindowListener(new java.awt.event.WindowAdapter(){
        	
        	
        	
        	@Override
			public void windowClosing(WindowEvent arg0) {
				AnimatedSequences.op = null;
        	}

			
        });
        
        jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Log scale", "Linear scale" }));
        jComboBox1.setSelectedIndex(AnimatedSequences.radiusLogScale?0:1);
        
        jComboBox1.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				AnimatedSequences.radiusLogScale = (jComboBox1.getSelectedIndex() == 0);
				
			}
        	
        });
        
        ScaleLabel.setText("Radius scale");

        SizeLabel.setText("Radius size factor");

        jTextField1.setText(""+AnimatedSequences.RadiusFactor);
        jTextField1.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				AnimatedSequences.RadiusFactor = Double.parseDouble(((javax.swing.JTextField) arg0.getSource()).getText());
				
			}
        	
        });

        jCheckBox1.setText("Show max exo saturation");
        jCheckBox1.setEnabled(AnimatedSequences.graph.saturableExo);
        jCheckBox1.setSelected(AnimatedSequences.showMaxExoSaturation);
        jCheckBox1.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				AnimatedSequences.showMaxExoSaturation = ((javax.swing.JCheckBox) arg0.getSource()).isSelected();
				
			}
        	
        });
        jCheckBox2.setText("Show max nick saturation");
        jCheckBox2.setEnabled(AnimatedSequences.graph.saturableNick);
        
        jCheckBox2.setSelected(AnimatedSequences.showMaxNickSaturation);
        jCheckBox2.addActionListener(new ActionListener(){

			@Override
			public void actionPerformed(ActionEvent arg0) {
				AnimatedSequences.showMaxNickSaturation = ((javax.swing.JCheckBox) arg0.getSource()).isSelected();
				
			}
        	
        });
        jCheckBox3.setText("Show max poly saturation");
        jCheckBox3.setEnabled(AnimatedSequences.graph.saturablePoly);
        jCheckBox3.setSelected(AnimatedSequences.showMaxPolySaturation);
        jCheckBox3.addActionListener(new ActionListener(){
        	
			@Override
			public void actionPerformed(ActionEvent arg0) {
				AnimatedSequences.showMaxPolySaturation = ((javax.swing.JCheckBox) arg0.getSource()).isSelected();
				
			}
        	
        });
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(ScaleLabel)
                            .addComponent(SizeLabel))
                        .addGap(18, 18, 18)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jComboBox1, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTextField1)))
                    .addComponent(jCheckBox1)
                    .addComponent(jCheckBox2)
                    .addComponent(jCheckBox3))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(ScaleLabel)
                    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(SizeLabel)
                    .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jCheckBox3)
                .addContainerGap())
        );

        pack();
    }
    // Variables declaration - do not modify
    private javax.swing.JLabel ScaleLabel;
    private javax.swing.JLabel SizeLabel;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JCheckBox jCheckBox1;
    private javax.swing.JCheckBox jCheckBox2;
    private javax.swing.JCheckBox jCheckBox3;
    // End of variables declaration
}

